home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr51 / tag_utes.zip / LISTDBFS.PRG next >
Text File  |  1993-04-01  |  3KB  |  67 lines

  1. PROCEDURE ListDbfs
  2. *-------------------------------------------------------------------------------
  3. *-- Programmer..: David Love (DAVIDLOVE)
  4. *-- Date........: 01/31/1992
  5. *-- Notes.......: This procedure will create a list of the database (.dbf) files
  6. *--               in the current directory.  It will create a database file
  7. *--               named Dbfs.dbf which exists of one 12-character field--Dbf.
  8. *--               It will also create a text file, Dbfs.txt, through the
  9. *--               LIST FILES TO FILE command.  Then it will append records
  10. *--               to the Dbfs.dbf file and erase the Dbfs.txt file.
  11. *--             : This Dbfs.dbf file can be SCANned, or used in a POPUP PROMPT
  12. *--               FIELD command, or in any way that you can imagine.
  13. *--             : The file 'Dbfs.dbf' will not be included in the Dbfs.dbf file.
  14. *-- WARNING===> : If your application includes a file with the name of
  15. *--               'Dbfs.dbf', it will be overwritten with the file created
  16. *--                by this procedure.
  17. *-- Written for.: dBASE IV, 1.1
  18. *-- Rev. History:
  19. *-- Calls.......: None
  20. *-- Called by...: Any
  21. *-- Usage.......: do ListDbfs
  22. *-- Returns.....: None
  23. *-- Parameters..: None
  24. *-- Acknowledgement..: Bowen Moursund for the code that creates Dbfs.dbf
  25. *--                    (Download PRGCREAT.ZIP for more info.)
  26. *-------------------------------------------------------------------------------
  27.  
  28.    PRIVATE cConsole
  29.    *-- Write the directory of dbf files to a text file (Dbfs.txt)
  30.    *-- First, erase the file if it exists
  31.    IF FILE("Dbfs.txt")
  32.      ERASE dbfs.txt
  33.    ENDIF
  34.  
  35.    *-- And, erase the dbfs.dbf file if it exists (so won't be included
  36.    *-- in the list)
  37.    IF FILE("Dbfs.dbf")
  38.      ERASE Dbfs.dbf
  39.    ENDIF
  40.  
  41.    *-- Now, write the dbfs.txt file
  42.    cConsole = SET("CONSOLE")
  43.    SET CONSOLE OFF
  44.    LIST FILES TO FILE dbfs.txt
  45.    SET CONSOLE &cConsole.
  46.  
  47.    *-- Then, create the file DBFS.DBF
  48.    SET PRINTER TO FILE DBFS.DBF
  49.    SET PRINTER ON
  50.    ??? "{3}{92}{2}{1}{0}{0}{0}{0}{65}{0}{13}{0}{0}{0}{0}{0}{0}{0}{0}{0}{0}{0}"+;
  51.    "{0}{0}{0}{0}{0}{0}{0}{0}{89}{0}{68}{66}{70}{0}{0}{0}{0}{0}{0}{0}{0}{67}{3}"+;
  52.    "{0}{44}{85}{12}{0}{0}{0}{1}{0}{0}{0}{0}{0}{0}{0}{0}{0}{0}{0}{13}{26}"
  53.    SET PRINTER TO
  54.    SET PRINTER OFF
  55.  
  56.    *-- Now, append dbfs.txt to dbfs.dbf if the record is a dbf listing.
  57.    USE Dbfs
  58.    APPEND FROM Dbfs.txt FOR ".DBF" $ Dbf TYPE SDF
  59.  
  60.    USE    && can remove this command if you want
  61.  
  62.    ERASE Dbfs.txt            && don't need it anymore
  63.  
  64. RETURN
  65.  
  66. *--EOP: Listdbfs.prg
  67.